0fa45de729441240384dc044b989aa97e39a6220,src/edu/stanford/nlp/sentiment/SentimentTraining.java,SentimentTraining,main,#String[]#,129
Before Change
// read in the trees
List<Tree> trainingTrees = SentimentUtils.readTreesWithGoldLabels(trainPath);
System.err.println("Read in " + trainingTrees.size() + " training trees");
List<Tree> devTrees = SentimentUtils.readTreesWithGoldLabels(devPath);
System.err.println("Read in " + devTrees.size() + " dev trees");
if (filterNeutral) {
Filter<Tree> neutralFilter = new Filter<Tree>() {
public boolean accept(Tree tree) {
int gold = RNNCoreAnnotations.getGoldClass(tree);
return gold != 2;
}
};
trainingTrees = CollectionUtils.filterAsList(trainingTrees, neutralFilter);
devTrees = CollectionUtils.filterAsList(devTrees, neutralFilter);
System.err.println("Filtered training trees: " + trainingTrees.size());
System.err.println("Filtered dev trees: " + devTrees.size());
}
// TODO: binarize the trees, then collapse the unary chains.
After Change
// read in the trees
List<Tree> trainingTrees = SentimentUtils.readTreesWithGoldLabels(trainPath);
System.err.println("Read in " + trainingTrees.size() + " training trees");
if (filterNeutral) {
trainingTrees = CollectionUtils.filterAsList(trainingTrees, NEUTRAL_FILTER);
System.err.println("Filtered training trees: " + trainingTrees.size());
}
List<Tree> devTrees = null;
if (devPath != null) {
devTrees = SentimentUtils.readTreesWithGoldLabels(devPath);
System.err.println("Read in " + devTrees.size() + " dev trees");
if (filterNeutral) {
devTrees = CollectionUtils.filterAsList(devTrees, NEUTRAL_FILTER);
System.err.println("Filtered dev trees: " + devTrees.size());
}
}